package day01;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

/**
 * 继承HttpServlet 去实现Servlet功能
 */
public class A03_HttpServlet extends HttpServlet {
    /**
     * 1.实现步骤
     *      1.自定义普通类继承HttpServlet,并重写doGet ()和 doPost()方法
     *      2.在都doPost方法中调用doGet方法
     *      3.在Web,xml文件中配置该Servlet
     */
    @Override
    protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        System.out.println("继承HttpServlet的方式");
    }

    @Override
    protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        doGet(req, resp);
    }
}
